package br.skytef.stmanager.utils;

import java.util.List;

import br.skytef.stmanager.daos.ClienteDAO;
import br.skytef.stmanager.entities.ClienteEntity;

public class Consulta {	
	public ClienteEntity cliente(String texto){
		ClienteEntity ce = null;
		try {
			int id = Integer.parseInt(texto);
			ce = new ClienteDAO().buscarCliente(id);
			return ce;
		} catch (Exception e) {	}
		try {
			long cnpj = new Cnpj().StringParaInteiro(texto);
			ce = new ClienteDAO().buscarCliente(cnpj);
			if(ce == null || ce.getCnpj() == 0)
				ce = new ClienteDAO().buscar(texto);
			return ce;
		} catch (Exception e) {
			return ce;
		}
	}

	public List <ClienteEntity> clientes(String texto){
		//		List <ClienteEntity> clientes = new ClienteDAO().buscarCliente(texto.toUpperCase().trim());
		return null;
	}
}